#-*- coding: utf8 -*-
from tutor.scripts import *
from tutor.plugins.sympy import *

while True:
    with display_block('Entradas'):
        # Escolhe ponto do limite
        X = oneof(0, 0, 0, 1, 1, 2, 3, 4, 5, 6)
        Y = oneof(0, 0, 0, 1, 1, 2, 3, 4, 5, 6)
        
        # Escolhe funções
        funcs = []
        while len(funcs) < 2:
            if oneof(0, 0, 1):
                f = x**oneof(1, 2, 3)
            elif oneof(0, 0, 1):
                f = oneof(sin, cos)(pi * x / 6)
            elif oneof(0, 1):
                f = sqrt(x)
            else:
                f = exp(x)
            funcs.append(Lambda(x, f))
        func = funcs[0](x) * funcs[1](y)

    with display_block('Resultados'):
        # Calcula resposta        
        ans = func.subs({x: X, y: Y})
        if ans not in [0, 1, 2, 3, 4, 5, 6]:
            continue
        values = [0] * 8
        value0, value1, value2, value3, value4, value5, value6, valueNE = values

